<template>
  <div>
    <div>
      <ul>
        <li v-for="message in messageList" :key="message.id">
          <!-- 第一种方法 -->
          <!-- <router-link :to="{name:'xiangqing',query:{id:message.id,title:message.title,content:message.content}}"> -->
          <router-link
            :to="{
              name: 'xiangqing',
              params: {
                id: message.id,
                title: message.title,
                content: message.content,
              },
            }"
          >
            {{ message.title }}
          </router-link>
        </li>
      </ul>
      <hr />
      <router-view></router-view>
    </div>
  </div>
</template>

<script>
import { nanoid } from "nanoid";
export default {
  name: "Message",
  // 准备初始化的数据
  data() {
    return {
      messageList: [
        { id: nanoid(), title: "中国联通", content: "你的余额不足" },
        { id: nanoid(), title: "中国广电", content: "你的余额够了" },
        { id: nanoid(), title: "中国移动", content: "你的余额不满足" },
      ],
    };
  },
};
</script>

<style scoped>
</style>